You can use the TRIM function to remove all spaces from a text string except single spaces between words.
In other words, TRIM will remove leading spaces at the beginning of a text string, trailing spaces at the end of a text string, and it will reduce multiple spaces within a text string to single spaces.
If you have a text value in cell A2, the formula =TRIM(A2) in another cell, for example B2, will return the result of the above.
Here is an example. B2 contains the formula =TRIM(A2) and B3 the formula =TRIM(A3).